doc,test: mem protection must be observed in ffi#62818
Open
bengl wants to merge 3 commits intonodejs:mainfrom
Open
doc,test: mem protection must be observed in ffi#62818bengl wants to merge 3 commits intonodejs:mainfrom
bengl wants to merge 3 commits intonodejs:mainfrom
Conversation
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62818 +/- ##
==========================================
- Coverage 91.55% 89.62% -1.93%
==========================================
Files 356 706 +350
Lines 149601 219136 +69535
Branches 23395 41982 +18587
==========================================
+ Hits 136967 196410 +59443
- Misses 12371 14618 +2247
- Partials 263 8108 +7845 π New features to boost your workflow:
|
Contributor
|
Codewise it LGTM! |
addaleax
reviewed
Apr 19, 2026
| '-p', | ||
| ` | ||
| const ffi = require('node:ffi'); | ||
| const { functions } = ffi.dlopen('${libraryPath}', ${symbols}) |
Member
There was a problem hiding this comment.
Suggested change
| const { functions } = ffi.dlopen('${libraryPath}', ${symbols}) | |
| const { functions } = ffi.dlopen(${JSON.stringify(libraryPath)}, ${symbols}) |
| #include <stdint.h> | ||
| #include <stdlib.h> | ||
| #include <string.h> | ||
| #include <sys/mman.h> |
Member
There was a problem hiding this comment.
The #ifdef _WIN32 below this line makes me assume that this file is also compiled on Windows, which means that this include here (and the actual function that was added) should probably be in #ifndef _WIN32 guards?
When using ffi.toBuffer, memory protection on any memory pages exposed must be observed by the caller, otherwise crashes will occur. Now documented, and tested.
43f68d7 to
b448d7f
Compare
f3d4109 to
48ebb7a
Compare
Collaborator
Contributor
|
@bengl https://ci.nodejs.org/job/node-test-binary-windows-js-suites/40143/ - This is the only relevant failure. |
Collaborator
Collaborator
ShogunPanda
approved these changes
Apr 21, 2026
Collaborator
Commit Queue failed- Loading data for nodejs/node/pull/62818 β Done loading data for nodejs/node/pull/62818 ----------------------------------- PR info ------------------------------------ Title doc,test: mem protection must be observed in ffi (#62818) Author Bryan English <bryan@bryanenglish.com> (@bengl) Branch bengl:bengl/ffi-mem-prot-doc-test -> nodejs:main Labels needs-ci, commit-queue-squash, ffi Commits 3 - doc,test: mem protection must be observed in ffi - fixup! doc,test: mem protection must be observed in ffi - fixup! fixup! doc,test: mem protection must be observed in ffi Committers 1 - Bryan English <bryan@bryanenglish.com> PR-URL: https://github.com/nodejs/node/pull/62818 Reviewed-By: Paolo Insogna <paolo@cowtech.it> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/62818 Reviewed-By: Paolo Insogna <paolo@cowtech.it> -------------------------------------------------------------------------------- βΉ This PR was created on Sun, 19 Apr 2026 04:39:14 GMT β Approvals: 1 β - Paolo Insogna (@ShogunPanda) (TSC): https://github.com/nodejs/node/pull/62818#pullrequestreview-4146967369 β This PR needs to wait 114 more hours to land (or 0 minutes if there is one more approval) β Last GitHub CI successful βΉ Last Full PR CI on 2026-04-21T04:58:19Z: https://ci.nodejs.org/job/node-test-pull-request/72808/ - Querying data for job/node-test-pull-request/72808/ β Build data downloaded β Last Jenkins CI successful -------------------------------------------------------------------------------- β Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/24718303601 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using ffi.toBuffer, memory protection on any memory pages exposed must be observed by the caller, otherwise crashes will occur.
Now documented, and tested.